#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int get_choice(void);
int get_int(void);
void upper_lower(void);
int files(int i,int j);
int main(void)
{
	int i = 0;
	while (i = get_choice() != 4)
	{
		switch (i)
		{
		case '1':upper_lower(); break;
		case '2':break;
		case '3':break;
		default:break;
		}
	}
	printf("bye.\n");

	return 0;
}

int get_choice(void)
{
	int i = 0;
	printf("Please choose one of the following:\n");
	printf("1.) copy files\t\t2.) move files\n");
	printf("3.) remove files\t\t4.) quit\n");
	printf("Enter the number of your choice : \n");
	i = get_int();
	while (i < 1 || i>4)
	{
		printf("%d is not 1~4.\n", i);
		i = get_int();
	}

	return i;
}

int get_int(void)
{
	int i = 0;
	char ch = 0;
	while (scanf("%d", &i) != 1)
	{
		while ((ch = getchar()) != '\n')
			putchar(ch);
		printf(" is not an integer.\n");
		printf("1~4.\n");
	}

	return i;
}

void upper_lower(void)
{
	int i = 0, j = 0;
	printf("upper limit.\n");
	i = get_int();
	printf("lower limit.\n");
	j = get_int();
	while (i < j)
	{
		printf("upper limit <lower limit.\n");
		printf("upper limit.\n");
		i = get_int();
		printf("lower limit.\n");
		j = get_int();
	}
	files(i, j);
}

int files(int i, int j)
{
	int n = 0;
	n = get_int();
	while (n<i || n>j)
	{
		printf("re-enter%d~%d", j, i);
		n = get_int();
	}

	return n;
}
